package com.woniuxy.businessassembly.dao;

import com.woniuxy.businessassembly.model.HotelInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.woniuxy.businessassembly.model.HotelSettle;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author Kevin Kwok
 * @since 2021-05-24
 */
@Mapper
public interface HotelInfoMapper extends BaseMapper<HotelInfo> {

    /*新增酒店信息展示*/
    @Insert("insert into hotel_info (hotel_name,hotel_tel,hotel_addr,hotel_desc,hotel_number,hotel_type,longitude,latitude) values (#{hotelName},#{hotelTel},#{hotelAddr},#{hotelDesc},#{hotelNumber},#{hotelType},#{longitude},#{latitude})")
    @Options(useGeneratedKeys=true, keyProperty="hotelId", keyColumn="id")
    int addHotelInfo(HotelInfo hotelInfo);

    /*修改酒店信息展示*/
    @Update("update hotel_info set hotel_name=#{hotelName},hotel_tel=#{hotelTel},hotel_addr=#{hotelAddr},hotel_desc=#{hotelDesc},hotel_number=#{hotelNumber},hotel_type=#{hotelType},longitude=#{longitude},latitude=#{latitude} where hotel_id=#{hotelId}")
    int modifyHotelInfo(HotelInfo hotelInfo);

    /*查询酒店的所有信息*/
    @Select("select * from hotel_info where hotel_name=#{hotelName}")
    HotelInfo queryHotelInfo(String hotelName);

    /*根据酒店类型来进行筛选*/
    @Select("select * from hotel_info where hotel_type=#{id}")
    List<HotelInfo> queryHotelInfoByType(Integer id);

    @Delete("delete from hotel_info where hotel_id=#{hotelId}")
    int deleteInfoById(Integer hotelId);
}
